package com.chiffoyqc.service;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.chiffoyqc.config.URLConfig;
import com.chiffoyqc.factory.ReturnCodeFactory;
import com.chiffoyqc.service.Interface.IHandleBatchChangePrice;
import com.chiffoyqc.utils.HttpHelper;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2018/7/18.
 * 7.18. 批量调价
 */
@Service
public class BatchChangePriceService implements IHandleBatchChangePrice {
    @Override
    public Map<String, Object> handleRequestMessage(String postData) {
        System.out.println("批量调价 传给zsy参数：" + postData);
        String result = HttpHelper.sendPostForNormal(URLConfig.batchChangePrice, postData, "utf-8");
        System.out.println("批量调价 zsy返回的结果："+ result);
        if(!result.equals("") ){
            Map<String,Object> dataMap = new HashMap<>();
            JSONObject jsonObject = JSON.parseObject(result);
            dataMap = ReturnCodeFactory.createReturnCodeMap(dataMap,jsonObject);
            return dataMap;
        }

        return null;
    }
}
